package com.zzh.partnersys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzh.partnersys.entity.UserDO;
import com.zzh.partnersys.entity.dto.UserTDO;
import com.zzh.partnersys.entity.vo.UserAvaGenVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * �û�??Mapper �ӿ�
 * </p>
 *
 * @author zzh
 * @since 2024-07-13
 */
public interface UserMapper extends BaseMapper<UserDO> {

    /**
     * ��̬�ж��޸��û���Щ��??
     * @param userTDO
     * @return
     */
    int updateUserInfoById(@Param("userTDO") UserTDO userTDO);


    /**
     * sql�Ż���ҳ��ѯ,�����ѯ
     * @param offset ������ʼλ��
     * @param pageSize ÿҳ��¼??
     * @return
     */
    List<UserDO> customPaginationQuery(long offset, long pageSize);

    //�޸ı�ǩ+״??
    @Update("update user set tags = #{json} , userStatus = 0 where id = #{id};")
    Integer updateTagsAndStatusById(long id, String json);
    //�޸ı�ǩ+״??�Ա�=??
    @Update("update user set tags = #{json} , gender = 1 , userStatus = 0 where id = #{id};")
    Integer updateTagsAndStatusAndGenderById(long id, String json);

    @Update("update user set avatarUrl = #{url} where id = #{id};")
    int updateAvaTarUrl(String url,Long id);

    //��ѯ�û��Ĳ�����??
    List<UserAvaGenVO> selectAvaGenByIdList(List<Long> idList);

    //�����û��˻�����ѯ�û���??
    List<UserDO> selectListByAccount(long parseLong);

    @Update("update user set userName = #{userName} where id = #{userId};")
    void updateUserName(int userId, String userName);

//    @Select("select id,username from user where isDelete = 0 limit 1,100000;")
//    List<UserES> selectListUserName();
}
